package cn.wod.jenkinsdemo;

import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;

import java.util.ResourceBundle;

import static android.content.pm.PackageManager.GET_META_DATA;

public class MainActivity extends AppCompatActivity {
    TextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = (TextView) findViewById(R.id.tv);
        tv.setText(getChanel());
       String  test= ResourceBundle.getBundle("global").getString("KEY_ALIAS");
        Log.d("====",test);
    }

    private String getChanel() {
        String Chanel;
        try {
            ApplicationInfo info = getPackageManager()
                    .getApplicationInfo(getPackageName(), GET_META_DATA);


            Chanel = info.metaData.getString("CHANNEL");
        } catch (Exception e) {
            e.printStackTrace();
            Chanel = "默认";
        }
        return Chanel;
    }
}
